package chat.fragments;

import android.app.DialogFragment;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.AdapterView;
import android.widget.BaseAdapter;
import android.widget.ListView;

import com.whu.zj.R;

import chat.adapter.FriendRequstAdapter;

/**
 * 好友请求信息显示
 * Created by 凯 on 2015/10/26.
 */
public class FreindRequestFragment extends DialogFragment {

    public static final String TAG_Freind = "friendrequestfrag";
    ListView lv_request;
    BaseAdapter adapter;

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {

        getDialog().requestWindowFeature(Window.FEATURE_NO_TITLE);
        View view = inflater.inflate(R.layout.fragment_friendrequest,container,false);
        initview(view);
        return view;
    }

    // 控制
    private void initview(View view) {
        lv_request = (ListView) view.findViewById(R.id.id_lv_request);
        adapter = new FriendRequstAdapter();
        lv_request.setAdapter(adapter);
        lv_request.setOnItemClickListener(new AdapterView.OnItemClickListener() {
            @Override
            public void onItemClick(AdapterView<?> parent, View view, int position, long id) {
                // 获取好友请求
//                FriendRequstAdapter fadapter = (FriendRequstAdapter) adapter;
//                AddNewFriends taf = (AddNewFriends) fadapter.getItem(position);
//
//                // 发送至处理
//                DealFragment fragment = new DealFragment();
//                fragment.setAddNewFriends(taf);
//                fragment.show(getFragmentManager(),DealFragment.TAG_DEALFRAG);
            }
        });


    }




}
